# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql

class BilibiliPipeline(object):
    def open_spider(self,spider):
        self.client = pymysql.MysqlClient()

    def process_item(self, item, spider):
        self.client.bilibili.bili.insert_one(item)
        return item


    def close_spider(self,spider):
        self.client.close()